<?php
/*if(isset($_POST['submit'])) {*/
if (!defined('BASEPATH') &&
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest')
header( 'Location: http://www.cetichn.com/error' ) ;
else
{
	$to = "cetichn@gmail.com";
	$subject = "Mensaje Pagina Cetic";
	$name_field = $_POST['name'];
	$email_field = $_POST['email'];
	$message = $_POST['message'];
	if ($name_field == '' || $email_field == '' || $message == '' || is_null($name_field) || is_null($email_field) || is_null($message))
	{
		echo "FAILURE";
	}
	elseif (strlen($message) <= 10 || strlen($name_field)<= 5)
	{
		echo "FAILURE";
	}
	else
	{
		$body = "De: $name_field\n Correo Electronico: $email_field\n Mensaje:\n $message";
		mail($to, $subject, $body);
		echo "SUCCESS";
	}
}
/*} else {
 echo "blarg!";
 }*/
?>